package com.zhy.mvc;

import com.zhy.mvc.DemoObj;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;

/**
 * 测试@ControllerAdvice注解的类
 * Created by zhy on 2017/5/8.
 */
@Controller
public class AdviceController {

    @RequestMapping("/advice")
    public String getSomething(@ModelAttribute("msg") String msg, DemoObj obj) {
        System.out.println(obj.getId() + "--" + obj.getName());
        System.out.println(msg);
        throw new IllegalArgumentException("非常抱歉， 参数有误/" + "来自@ModelAttribute: " + msg);
    }
}
